﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:control="clr-namespace:ReportingManagement.Components" x:Class="ReportingManagement.Components.DHIS.DHISLogin" 
        mc:Ignorable="d" Width="350" WindowStartupLocation="CenterOwner" d:DesignWidth="300" 
        ResizeMode="NoResize" Title="DHIS2 Login Credentials" ShowInTaskbar="False" SizeToContent="Height" 
        Height="240">
    <Window.Resources>
        <Style x:Key="ControlBaseStyle" TargetType="{x:Type Control}">
            <Setter Property="Margin" Value="5" />
        </Style>
        <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}" BasedOn="{StaticResource ControlBaseStyle}">
            <Setter Property="Background" Value="WhiteSmoke" />
        </Style>
        <Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource ControlBaseStyle}">
            <Setter Property="Background" Value="WhiteSmoke" />
        </Style>
        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource ControlBaseStyle}">
            <Setter Property="Margin" Value="10,5,5,5" />
            <Setter Property="Padding" Value="10,2" />
        </Style>
    </Window.Resources>

    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Label Content="Username" Grid.Row="1" Style="{StaticResource ControlBaseStyle}" />
        <TextBox x:Name="txtUsername" Grid.Row="1" Grid.Column="1" Style="{StaticResource TextBoxStyle}" Text="{Binding Username}" />

        <Label Content="Password" Grid.Row="2" Style="{StaticResource ControlBaseStyle}" />
        <PasswordBox x:Name="txtPassword" Grid.Row="2" Grid.Column="1" Style="{StaticResource PasswordBoxStyle}" />

        <CheckBox x:Name="chboxDontAskAgain" Grid.Row="3" Grid.Column="1" Content="Don't ask again during this session" Style="{StaticResource ControlBaseStyle}"
			ToolTip="The information you're providing is not stored in any persistent storage. It only exists in memory for the duration of this session. IQSMS does not store any DHIS2 login credentials." />

        <DockPanel Grid.Row="5" Grid.Column="1" LastChildFill="False">
            <Button x:Name="btnCancel" Content="Cancel" DockPanel.Dock="Right" IsCancel="True" />
            <Button Content="Login to DHIS" DockPanel.Dock="Right" x:Name="btnLogin" IsDefault="True" Click="btnLogin_Click" />
        </DockPanel>

        <Viewbox Grid.Row="4" Grid.RowSpan="2" Height="80" Width="80">
            <control:LoadingAnimation x:Name="loadingAnimation" />
        </Viewbox>
    </Grid>
</Window>
